<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js" ></script>
<script type="text/javascript">

function notif_activation() {

        var c = confirm("Apakah anda yakin akan membatalkan perpanjangan masa aktif untuk data ini ?");
        if (c == true) {
            return true;
        } else {
            return false;
        }
    }
</script>
<?php
$this->breadcrumbs = array(
    'MLM System',
    'Data Request Perpanjangan' => array('unpaid_list'),
);

$this->menu = array();

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('sys-member-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<?php if (Yii::app()->user->hasFlash('success')): ?>
    <div class="alert alert_grey">
        <img height="24" width="24" src="<?php echo Yii::app()->params['backendUrl']; ?>/images/icons/small/grey/success.png">
        <?php echo Yii::app()->user->getFlash('success'); ?>
    </div>
<?php endif; ?>
<?php if (Yii::app()->user->hasFlash('error')): ?>
    <div class="alert alert_grey">
        <img height="24" width="24" src="<?php echo Yii::app()->params['backendUrl']; ?>/images/icons/small/grey/alert_2.png">
        <?php echo Yii::app()->user->getFlash('error'); ?>
    </div>
<?php endif; ?>
<div class="flat_area grid_16">
    <h2>Data Request Perpanjangan</h2>
</div>
<div class="box grid_16 round_all">
    <h2 class="box_head grad_colour round_all">Advanced Search</h2>
    <a href="#" class="grabber">&nbsp;</a>
    <a href="#" class="toggle toggle_closed">&nbsp;</a>
    <div class="toggle_container" style="display:none;">
        <?php
        $this->renderPartial('_search', array(
            'model' => $model,
        ));
        ?>
    </div>
</div>
<!-- search-form -->
<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'sys-member-grid',
    'dataProvider' => $model->search_unpaid(),
    //'filter' => $model,
    'columns' => array(
        array(
            'header' => 'No.',
            'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)."."',
            'htmlOptions' => array('style' => 'text-align:center;'),
        ),
        array(
            'header' => 'Member Id',
            'name' => 'network_mid',
            'value' => '$data->network_mid',
        ),
        array(
            'header' => 'Nama Member',
            'name' => 'member_name',
            'value' => '$data->member_name',
        ),
        array(
            'header' => 'No Telepon',
            'name' => 'member_mobilephone',
            'value' => '$data->member_mobilephone',
        ),
        array(
            'header' => 'Tanggal Expired',
            'name' => 'member_activation_end_date',
            //'value' => '$data->date(member_activation_end_date)',
            'value' => 'Yii::app()->dateFormatter->format("dd-MM-yyyy", $data->member_activation_end_date)',
            'htmlOptions' => array('style' => 'text-align:center;'),
        ),
        array(
            'header' => 'Penambahan Masa Aktif (thn)',
            'name' => 'member_activation_request_quantity',
            'value' => '$data->member_activation_request_quantity',
            'htmlOptions' => array('style' => 'text-align:center;'),
        ),
        array(
            'header' => 'Keterangan',
            'name' => 'member_activation_request_note',
            'value' => '$data->member_activation_request_note',
            'htmlOptions' => array('style' => 'text-align:center;'),
        ),
        array(
            'header' => 'Tanggal Request',
            'name' => 'member_activation_request_datetime',
            //'value' => '$data->member_activation_request_datetime',
            'value' => 'Yii::app()->dateFormatter->format("dd-MM-yyyy", $data->member_activation_request_datetime)',
        'htmlOptions' => array('style' => 'text-align:center;'),
            ),
        array(
            'header' => 'Approve',
            'class' => 'CButtonColumn',
            'template' => '{approve}',
            'buttons' => array(
                'approve' => array(
                    'imageUrl' => Yii::app()->request->baseUrl . '/images/icon/adm_checklist_navy.png',
                    'url' => 'Yii::app()->createUrl("admin/system/member_extend/updateunpaid", array("id"=>$data->member_activation_request_id))',
                ),
            ),
            'htmlOptions' => array('style' => 'width: 8%;text-align: center;'),
        ),
        array(
            'header' => 'Delete',
            'class' => 'CButtonColumn',
            'template' => '{delete} ',
            'buttons' => array(
                'delete' => array(
               'imageUrl' => Yii::app()->request->baseUrl . '/images/icon/adm_delete_navy.png',     
               'url' => 'Yii::app()->createUrl("admin/system/member_extend/delete", array("id"=>$data->member_activation_request_id))',
               'onclick'=>'notif_activation();',
                ),
            ),
            'htmlOptions' => array('style' => 'width: 8%;text-align: center;'),
        ),
    ),
    'selectableRows' => 1,
    'selectionChanged' => 'userClicks',
    'pager' => array(
        'cssFile' => Yii::app()->params['backendUrl'] . '/css/style-pager.css',
        'header' => '',
        'firstPageLabel' => 'First',
        'prevPageLabel' => 'Previous',
        'nextPageLabel' => 'Next',
        'lastPageLabel' => 'Last',
    ),
    'cssFile' => Yii::app()->params['backendUrl'] . '/css/style-gridview.css',
    'loadingCssClass' => '',
));
?>
<script>
    var id = 0;
    var row = 0;
    function userClicks(target_id) {
        id = $.fn.yiiGridView.getSelection(target_id);
        //id = $.fn.yiiGridView.getKey(target_id, 2);
        //alert(id);
    }

    function clickReport(target_id) {
        id = $.fn.yiiGridView.getSelection(target_id);
        alert(id);
        return false;
    }
</script>

<div id="dialog" style="text-align: left;display: none; ">
    <div class="box grid_16">
        <a href="#" class="grabber">&nbsp;</a>
        <a href="#" class="toggle">&nbsp;</a>
        <div class="toggle_container">
            <div class="wizard">		
                <div class="wizard_steps">
                    <ul class="clearfix">
                        <li class="current">
                            <a href="#bonus" class="clearfix">
                                <span><strong>Summary Bonus</strong></span>

                            </a>
                        </li>
                        <li>
                            <a href="#ewallet" class="clearfix">
                                <span><strong>Statement Bonus</strong></span>

                            </a>
                        </li>
                        <li>
                            <a href="#network" class="clearfix">
                                <span><strong>Historis Withdrawal</strong></span>

                            </a>
                        </li>
                        <li>
                            <a href="#upgrade" class="clearfix">
                                <span><strong>Historis Upgrade</strong></span>

                            </a>
                        </li>
                    </ul>		
                </div>
            </div>
            <div id="div_content" class="block grid_16 alpha omega wizard_content">

            </div>
        </div>
    </div>
    <script type="text/javascript">

        // wizard
        $('.wizard_steps ul li a').click(function() {

            $('.wizard_steps ul li').removeClass('current');
            $(this).parent('li').addClass('current');

            var step = $(this).attr('href');
            var step_num = $(this).attr('href').replace('#step_', '');
            var step_multiplyby = (100 / $(".wizard_steps > ul > li").size());
            var prog_val = (step_num * step_multiplyby);

            $("#progressbar").progressbar({value: prog_val});

            $('.wizard_content').children().hide();
            $('.wizard_content').children(step).fadeIn();

            return false;
        });

        $('button.next_step').click(function() {

            var step = $(this).attr('id');
            var hash_step = ('#' + step);

            var step_num = $(this).attr('id').replace('step_', '');
            var step_multiplyby = (100 / $(".wizard_steps > ul > li").size());
            var prog_val = (step_num * step_multiplyby);

            $("#progressbar").progressbar({value: prog_val});

            $('.wizard_steps ul li').removeClass('current');
            $('a[href=' + hash_step + ']').parent().addClass('current');

            $('.wizard_content').children().hide();
            $('.wizard_content').children(hash_step).fadeIn();

            return false;
        });


    </script>

</div>
